package com.mcxx.modules.system.service.read;

import com.mcxx.modules.base.service.read.AreaHelper;
import com.mcxx.modules.base.utils.QueryParamUtil;
import com.mcxx.modules.system.dao.read.CustomUserReadDao;
import com.mcxx.modules.system.dto.CustomUserDTO;
import com.yinhai.ta404.core.transaction.annotation.TaTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
@TaTransactional(readOnly = true)
public class CustomUserReadService {
    @Autowired
    private CustomUserReadDao customUserReadDao;
    @Autowired
    private AreaHelper areaHelper;


    public List<CustomUserDTO> listByAreaCode(String areaCode) {

        AreaHelper.AreaPo areaPo = areaHelper.getAreaByCode(areaCode);
        Integer areaLevel = areaPo.getAreaLevel();
        areaCode = QueryParamUtil.setAreaCodeByLevel(areaCode, areaLevel);

        return customUserReadDao.listByAreaCode(areaCode);
    }
}
